package iedcyt.acute.controller.listeners.maesorgPublication;

import iedcyt.acute.model.MaesorgPublicationModel;
import iedcyt.acute.view.MaesorgPublicationView;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class PublicationSelectionListener implements Listener {

	private MaesorgPublicationModel _model;
	private MaesorgPublicationView _view;
	
	public PublicationSelectionListener(MaesorgPublicationView view, MaesorgPublicationModel model) {
		this._model = model;
		this._view = view;
	}
	
	@Override
	public void handleEvent(Event event) {
		Integer idPub = _view.getSelectedPublicationID();
		_model.setSelectedPublicationId(idPub);
		_model.printSelectedPublication();
		_view.loadCandidates(_model.getCandidates());
		_view.loadPublication_jsss(_model.getNoABV_posibles_jsss());
		_view.loadCandidates_jsss(_model.getCandidate_jsss());
	}
}
